package com.Tokiu.web.request;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * 请求转发
 * 只能在内部抓发
 */
@WebServlet("/rep2")
public class ServletDemo5 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        System.out.println("demo5...");

        //设置一个request对象的值
        request.setAttribute("wage",50000);
        //获取转发路径 forward携带res resp
        request.getRequestDispatcher("/rep3").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
